package ch03.tist;

import ch03.dao.NewsDao;
import ch03.factory.AbstrractFactory;
import ch03.factory.MySqlDaoFactory;
import ch03.jopo.News;
import ch03.service.NewsServiceImpl;

public class test2 {
    public static void main(String[] args) {
        //改变具体工厂可创建不同产品
        AbstrractFactory factory = new MySqlDaoFactory();
        NewsDao dao = factory.getInstance();
        NewsServiceImpl service = new NewsServiceImpl();
        service.setDao(dao);
        service.save(new News());
    }
}
